 <projecta charset="utf-8">

<div class="box box-primary" id="app_cases_editz" style="max-height: 720px;height: 430px;">
      <form role="form" id=project_edit_form>
			 <div class="row">
			 
				 <div class="col-md-8">
					   <div class="box-body">
					   
					                <div class="form-group">
					                  <label for="title">标题</label>
					                  <input type="text" name="title" v-model="casez.title" class="form-control" id="title" placeholder=""  required aria-required="true" >
					                </div>
					                 <div class="form-group">
					               &nbsp;
					             </div> 
								 <div class="form-group">
					                  <label for="title">描述</label>
					                  <textarea type="text" cols="4" rows="4" name="contentShort" v-model="casez.contentShort" class="form-control" id="contentShort" placeholder=""  required aria-required="true" ></textarea>
					             </div> 
					               <div class="form-group">
					               &nbsp;
					             </div> 
					              <div class="form-group">
					                 <div id="uploader-demo" class="form-group">
						                
										    <div id="fileList" class="uploader-list"></div>
										    <div id="filePickerz">选择图片</div>
										</div>
					             </div> 
					             <span>图片大小要求 [w_280，h_280]</span>
					 </div>
				  </div>
				  
				  <div class="col-md-4">
				  	<img alt="" src="" width="280px" height="280px" id="caseImg">
				 </div>
			 
			
          </div>
              <!-- /.box-body -->
              <div class="box-footer">
                 <button type="button" class="btn btn-default" v-on:click="cancel">取消</button>
                 <button type="button" class="btn btn-info pull-right"  v-on:click="doCreate">提交</button>
              </div>
            </form>



<script type="text/javascript">
//#1关于我们，2服务热线，3联系我们-公司邮箱，4联系我们-公司传真，5联系我们-公司地址，6联系我们-经纬度地址，7联系我们-咨询热线	8会议注册开通协议，9案例编辑，10问题指南--开通说明，11问题指南--常见问题，12资讯 #
 var app_cases_edit_vue=   new Vue({
                el: '#app_cases_editz',
                data:  {
                	casez:{
                		id: null,
                		title: "",
                		contentShort: "",
                		cmsType: null,
            			img: ""
            		},
            	    bus:new Vue()
             }, 
             mounted: function(){
            	 var _this=this;
            	 var id=zfesLayerEditDg.getCallBackParam().id;
            	
            	 if(id){
            		 _this.casez.id=id; 
            		 _this.doinitCase();
            	 }
             }, 
             methods: {
            	 doinitCase: function () {
            		 var _this=this;
            			var url="/met/service/pub/metCmsContent/loadMetCmsContent";
        	    		zfesAjax.ajaxTodo(url,{"id":_this.casez.id}, function(data){
        	    			_this.casez=data.data.metCmsContent;
        	    			$("#caseImg").attr("src",_this.casez.img+"?"+ Math.floor(Math.random()*100)).fadeIn();
        	    		});
        	    		
            	    },
                	 doCreate: function () {
                		 var _this=this;
                	    	if($("#project_edit_form").valid()){
                	    		_this.casez.cmsType=9;
                	    		console.log(_this.casez);
                	    		var url="/met/service/admin/metCmsContent/createMetCmsContent";
                	    		zfesAjax.ajaxTodo(url,_this.casez, function(data){
                	    			alertSwal.successText(data.message);
                	    			layer.close(layer.index);
                	    		})
                	    	}
                	    },
                	  
                	    cancel: function(){
                	    	 layer.close(layer.index);
                	    	 
                	    }
            }
        });
       var uploaderz ;
        $(function(){
        	var contentType="";//zfesLayerEditDg.getLayerParam().contentType;
        	//$("#caseImg").attr("src",stc);
        	uploaderz = WebUploader.create({
                auto: true,
                swf:   '/static/lib/webuploader/Uploader.swf',
                server: '/met/service/tenant/upload/uploadCaseImg',
                pick: '#filePickerz',
                accept: {
                    title: 'Images',
                    extensions: 'gif,jpg,jpeg,bmp,png',
                    mimeTypes: 'image/*'
                }
            }).on( 'uploadSuccess', function( data , response) {
                $("#caseImg").attr("src","/"+response.data.fileUrl+"?"+ Math.floor(Math.random()*100)).fadeIn();
                app_cases_edit_vue.$data.casez.img=response.data.fileUrl;
            }).on( 'uploadError', function( file , response) {
                alertSwal.warningText(response.data.message);
            });
        });
        


 </script>
</div>